function x = sample_by_sample(amplitude,f,f_sample,N)
% function that makes samples of a sine wave with for loop
% amplitude is amplitude of the sinewave
% f is the frequency of the signal
% f_sample is the sample frequency of the signal
% N is the number of points = number of samples + 1


%% Sampling %%

T = 1/f;
Ts = (1 / (f_sample)); % finds the sampling period
% t = [0:Ts:Ts*N];

t = [0:Ts:(N-1) * Ts]

% f1 = [-N/2:((N/2)-1)]*(f_sample/N);
% f2 = f1';
% t = 1./f;
x = zeros(1,N);
temp = 0;

for count = 1:(N) % for loop of sampling
    temp = amplitude * sin(2 * pi * f * t(count));
    x(count) = temp; 
end



%% RMS value %%


value = 0;

for count = 1:N
    value = value + (x(count)^2);
end

RMS_value = sqrt(value * (1/N))



%% sampling sine wave plotting %%


plot(t,x)
xlabel('t')
ylabel('x(t)')
legend('analytic solution')
